Skip to content

Instantly share code, notes, and snippets.

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@David-Lor
David-Lor / telebot_polling_template.py
Last active May 19, 2024 04:07
pyTelegramBotAPI - Never ending bot polling (recovery in failure)
"""
This is how I run my new bots created with pyTelegramBotAPI to avoid API errors,
like timeout errors or whenever my server can't reach Telegram servers (i.e. if net is down).
A while loop restarts the polling when it's ended due to an error.
A new bot object is created in each new loop execution, to avoid some errors.
We set all our message handlers in botactions() so the new bot object can use them.
Threading is not needed, but I prefer running the while True loop threaded so I can stop the bot
anytime with Ctrl+C, otherwise it can't be stopped easily. Killing the script is not nice and
I use databases in some bots, which should be closed beforehand.
@JakubOboza
JakubOboza / private-docker-regs-with-free-tiers.markdown
Created May 30, 2019 07:15
Private Docker registry with free tiers for Developers.

List of sites with free tier limits

  • Docker Hub - One private repo/image spot for free
  • Three Scale - Very generous free tier 50GB of space, 500 Pulls a month etc..
  • Canister - 20 private repos with almost no limits on free tier
  • Code Fresh - Free tier for developers

Setup your own private registry

@lilydjwg
lilydjwg / btrfs-autosnapshot
Last active May 19, 2024 04:07
btrfs-autosnapshot
#!/usr/bin/python3
import os
import datetime
import subprocess
import logging
import tempfile
import contextlib
from pathlib import Path
@Ravarcheon
Ravarcheon / spectralRotation.py
Last active May 19, 2024 04:04
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
import numpy as np
import soundfile as sf
from scipy.fftpack import fft, ifft
def rotateSignal(signal,flip):
if flip:
signal = signal[::-1]
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft
rotSig = ifft(x)
@pandax381
pandax381 / ix3315.startup-config
Last active May 19, 2024 04:03
IX3315 にフレッツ光クロス2回線(OCNバーチャルコネクトおよびv6プラス固定IP)を収容するためのコンフィグ
! NEC Portable Internetwork Core Operating System Software
! IX Series IX3315 (magellan-sec) Software, Version 10.7.18, RELEASE SOFTWARE
! Compiled Oct 25-Tue-2022 12:28:03 JST #2
! Current time Apr 26-Wed-2023 16:52:00 JST
!
timezone +09 00
!
logging buffered 819200
logging subsystem flt warn
logging subsystem mape debug
@rxaviers
rxaviers / gist:7360908
Last active May 19, 2024 04:02
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@CSaratakij
CSaratakij / solution.md
Last active May 19, 2024 04:00
SQL query practice : 6002526

SQL query practice : (6002526)

Lesson 1 : SELECT queries 101

  1. Find the title of each film
SELECT title FROM movies;
  1. Find the director of each film
@romainl
romainl / redir.md
Last active May 19, 2024 03:59
Redirect the output of a Vim or external command into a scratch buffer

Redirect the output of a Vim or external command into a scratch buffer

Usage (any shell)

Show full output of command :hi in scratch window:

:Redir hi

Show full output of command :!ls -al in scratch window:

@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active May 19, 2024 03:58
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub